import App from "./App";
import uviewPlus from "@/uni_modules/uview-plus";
import * as Pinia from "pinia";
// #ifndef VUE3
import Vue from "vue";
import "./uni.promisify.adaptor";
Vue.config.productionTip = false;
App.mpType = "app";
const app = new Vue({
  ...App,
});
app.$mount();
// #endif

// #ifdef VUE3
import { createSSRApp } from "vue";
import { createPinia } from "pinia";
import OpenAI from "openai";
import piniaPluginPersistedstate, { createPersistedState } from "pinia-plugin-persistedstate";
export function createApp() {
  const app = createSSRApp(App);
  app.use(uviewPlus);
  const pinia = createPinia();
  pinia.use(
    createPersistedState({
      key: (id) => `__persisted__${id}`,
      storage: {
        getItem: (key) => uni.getStorageSync(key),
        setItem: (key, value) => uni.setStorageSync(key, value),
      },
    })
  )
  app.use(pinia);
  return {
    app,
    Pinia,
  };
}
// #endif
